package com.videoStream.video.rtsp;

/**
 * @Author: wwy
 * @Date: 2022/7/14 10:24
 */
public class RtspContext {
    private BuildRtsp buildRtsp;

    public RtspContext(BuildRtsp buildRtsp) {
        this.buildRtsp = buildRtsp;
    }

    /**
     * 生成rtspUrl
     * @param ip
     * @param username
     * @param password
     * @param channel
     * @param stream
     * @param port
     * @return
     */
    public String rtspUrl(String ip, String username, String password,int channel,String stream, short port){
        //校验参数
        boolean verify = RtspParamVerify.verify(ip, username, password,stream);
        if(!verify){
            return null;
        }
        return buildRtsp.build(ip,username,password,channel,stream,port);
    }


    /**
     * 生成rtspUrl
     * @param ip
     * @param username
     * @param password
     * @param channel
     * @param stream
     * @return
     */
    public String rtspUrl(String ip, String username, String password,int channel,String stream){
        return this.rtspUrl(ip,username,password,channel,stream, (short) 554);
    }

    /**
     * 生成rtspUrl
     * @param ip
     * @param username
     * @param password
     * @param channel
     * @return
     */
    public String rtspUrl(String ip, String username, String password,int channel){
        return this.rtspUrl(ip,username,password,channel,"main");
    }

}
